<?php

namespace backend\models;

use yii\base\Model;

class RoleForm extends Model {
	//属性
	public $RoleName;//角色名称
	public $description;//描述
	public $SortID;//排序编码
	public $State;//状态
	//规则
	public function rules(){
		return [
			[['RoleName','description','SortID','State'],'required','message'=>'{attribute}不能为空','on'=>'addrole'],
			['RoleName','unique','targetClass'=>TauRoleinfo::className(),'targetAttribute'=>'RoleName','message'=>'角色名已存在','on'=>'addrole'],
			['SortID','integer','integerOnly'=>true,'message'=>'请输入数字','on'=>'addrole'],
			[['RoleName','description','SortID','State'],'required','message'=>'{attribute}不能为空','on'=>'update'],
			['SortID','integer','integerOnly'=>true,'message'=>'排序编码请输入数字','on'=>'update'],
		];
	}
	//场景
	public function scenarios(){
		return [
			'addrole'=>['RoleName','description','SortID','State'],
			'update'=>['RoleName','description','SortID','State'],
		];
	}
	//属性标签
	public function attributeLabels(){
		return [
			'RoleName'=>'角色名称',
			'description'=>'角色描述',
			'SortID'=>'排序编码',
			'State'=>'状态'
		];
	}
	
}

?>